package net.interfax.impl;

import org.apache.commons.lang3.StringEscapeUtils;

public class FaxStatus implements XmlSerializable {
	public FaxStatus(String username, String password, long lastTransactionID, int maxItems) {
		this.username = username;
		this.password = password;
		this.lastTransactionID = lastTransactionID;
		this.maxItems = maxItems;
	}
	
	@Override
	public String toXml() {
		final StringBuilder builder = new StringBuilder();
		
		builder.append("<FaxStatus xmlns=\"http://www.interfax.cc\">")
			.append("<Username>").append(StringEscapeUtils.escapeXml(username)).append("</Username>")
			.append("<Password>").append(StringEscapeUtils.escapeXml(password)).append("</Password>")
			.append("<LastTransactionID>").append(lastTransactionID).append("</LastTransactionID>")
			.append("<MaxItems>").append(maxItems).append("</MaxItems>")
			.append("</FaxStatus>");
		
		return builder.toString();
	}
	
	public final String username;
	public final String password;
	public final long lastTransactionID;
	public final int maxItems;
}
